package com.vhall.component.framework.oss.client.impl.alicloud;


import com.vhall.component.framework.common.exception.ErrorCode;
import com.vhall.component.framework.common.exception.GlobalErrorCode;
import com.vhall.component.framework.oss.client.OssCodeMapping;
import com.vhall.component.framework.oss.client.OssErrorCode;

/**
 * https://help.aliyun.com/document_detail/32023.html?spm=a2c4g.11186623.6.986.5da846a1kIYszS
 *
 * @author yongzheng.xu
 * @date 2021/5/22 21:50
 */
public class AliCloudCodeMapping implements OssCodeMapping {

    @Override
    public ErrorCode apply(String s) {
        switch (s) {
            case "OK":
                return GlobalErrorCode.SUCCESS;
            case "MissingAccessKeyId":
                return OssErrorCode.EXCEPTION;
            default:
                return OssErrorCode.UNKNOWN;
        }
    }
}
